# -*- coding:utf-8 -*-
import time
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

# 代码有取巧的用途，需要手动点击验证
class LoginData(object):
    def __init__(self):
        self.url = "https://www.geetest.com/demo/click-float.html"
        self.driver = webdriver.Chrome()  # 创建浏览器对象

    def chrome_settings(self):
        # 打开浏览器指定页面
        self.driver.get(self.url)

        # 设置打开浏览器窗口长和宽
        self.driver.set_window_size(1100, 900)
        time.sleep(2)

        # 点击验证
        self.driver.find_element(By.XPATH, '//*[@id="captcha"]/div[3]/div[2]/div[1]/div[3]/span[1]').click()
        time.sleep(10)

        click = self.driver.find_element(By.CLASS_NAME, 'geetest_commit_tip').click()
        time.sleep(1)
        self.driver.find_element(By.ID, 'btn').click()


if __name__ == '__main__':
    login = LoginData()
    login.chrome_settings()
